import { SET_TOKEN, SET_USER_INFO, SET_USER_RIGHT } from "../types"

const infoState={
    userInfo:[],
    token:'',
    userRight:[]
}

export default (state=infoState,action)=>{
    const newState=JSON.parse(JSON.stringify(state))
    switch (action.type){
        case SET_TOKEN:
            newState.token=action.token
            return newState
        case SET_USER_INFO:
            newState.userInfo=action.userInfo
            return newState
        default:
            return newState
    }
}